Skip to content

Freeze the clock in the conference archiving regression tests - #524

Merged
JesperDramsch merged 2 commits into
mainfrom
ai-agent/friendly-heisenberg-fieds9
Nov 2, 2026
Merged

JesperDramsch merged 2 commits into
mainfrom
ai-agent/friendly-heisenberg-fieds9

Conversation

@JesperDramsch

Copy link
Copy Markdown
Owner

TestConferenceArchiving in tests/regression/test_conference_archiving.py built its fixtures from the real clock, using date spans of a few days to a few weeks. On some days of the year those spans cross New Year, and the schema rejects them with "Are you sure this is a multi-year conference?".

Failure windows found by running the file under a frozen clock:

  • test_archive_boundary_conditions: 30 Dec to 1 Jan
  • test_identify_past_conferences, test_bulk_archiving_process: about 18 to 21 Nov and 6 to 9 Feb
  • test_archive_preserves_data_integrity: about 6 to 9 Feb
  • test_archive_with_extended_deadline: about 29 Nov to 1 Dec
  • test_archive_with_timezone_handling: about 8 to 9 Jan

Change

  • An autouse fixture pins the clock to 2026-06-15 12:00 UTC for the whole class. It's a fixture rather than a class decorator so the date-building fixtures run frozen too.
  • With the clock pinned, test_archive_boundary_conditions now checks the real behaviour instead of only asserting that the result is a bool. A deadline one hour ago is still open in AoE (no timezone) and has passed in UTC.

Tests

  • tests/regression/test_conference_archiving.py: 14 passed on the real clock, and also with the clock frozen at 2026-11-02, 2026-11-19, 2026-11-30, 2026-12-31 20:00, 2027-01-01 00:30, 2027-01-08 and 2027-02-07.
  • Full suite on the real clock: 2560 passed, 5 skipped, 3 xfailed, 2 xpassed.
  • uvx ruff@0.4.4 check: clean. black@24.4.2 --check: unchanged.

Generated by Claude Code

TestConferenceArchiving built its fixtures from the real clock with date
spans of a few days to a few weeks. On some days of the year those spans
straddle New Year and the schema rejects them as multi-year conferences:
the boundary test failed from 30 December into 1 January, and the past,
future, extended-deadline and timezone tests have their own windows in
November, January and February.

An autouse fixture now pins the clock mid-year for the whole class. With
the clock fixed, the boundary test asserts the actual behaviour instead of
only checking for a bool: a deadline one hour ago is still open in AoE and
has passed in UTC.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016a2XGjJgh5Shvhnbc1LL3t
@github-actions github-actions Bot added the Tests label Nov 2, 2026

Copy link
Copy Markdown
Owner Author

Routine review

1. Request

No linked issue; the PR's own words: freeze the clock for TestConferenceArchiving in tests/regression/test_conference_archiving.py so its date-relative fixtures stop crossing New Year, covering test_archive_boundary_conditions, test_identify_past_conferences, test_bulk_archiving_process, test_archive_preserves_data_integrity, test_archive_with_extended_deadline and test_archive_with_timezone_handling, and make test_archive_boundary_conditions assert real AoE/UTC behaviour instead of only isinstance(..., bool).

2. Checked against

  • date: Mon Nov 2 11:50:36 UTC 2026.
  • No external facts in this review. The AoE claim was checked against utils/sort_yaml.py:72-79 (no timezone → Etc/GMT+12, so a naive "now − 1 h" deadline normalises to now + 11 h UTC) and utils/sort_yaml.py:111-112.

3. Needs your decision

None. The boundary-test rewrite is named in the PR body and stays inside the file being fixed.

4. Findings

Important: None.

Nits:

  • Possible nit: FROZEN_NOW = "2026-06-15 12:00:00" (tests/regression/test_conference_archiving.py:27) has no zone. freezegun reads a naive string as UTC, so it works, but "2026-06-15 12:00:00+00:00" would make the boundary test's AoE/UTC reasoning readable without knowing that default.
  • The PR body lists 8–9 Jan as a failure window for test_archive_with_timezone_handling, but the base file passed under a clock frozen at 2027-01-08 12:00 UTC. The window may be narrower or depend on the hour. This doesn't affect the fix.

5. Tests

The invariant ("no fixture date span crosses a year boundary, whatever the real date") is covered by the autouse _frozen_clock fixture, which applies to every test in the class, including the date-building fixtures. The boundary test now pins both sides: AoE still open (False), UTC passed (True).

I ran the base and changed versions of the file with the whole session frozen at each listed window (a pytest_configure plugin calling freeze_time(...).start()). Python 3.11 through uv with the REVIEW.md package set:

Frozen at (UTC) base (origin/main) change (b2e9032)
2026-11-02 11:00 14 passed 14 passed
2026-11-19 12:00 2 failed, 12 passed 14 passed
2026-11-30 12:00 1 failed, 13 passed 14 passed
2026-12-31 20:00 1 failed, 13 passed 14 passed
2027-01-08 12:00 14 passed 14 passed
2027-02-07 12:00 3 failed, 11 passed 14 passed

So the base fails and the change passes in every window I could reproduce.

Change, real clock:

tests/regression/test_conference_archiving.py: 14 passed in 2.32s
tests/ (full): 2560 passed, 5 skipped, 3 xfailed, 2 xpassed, 251 warnings in 141.09s (0:02:21)
uvx ruff@0.4.4 check utils tests: All checks passed!

GitHub statuses on b2e9032 at review time: pre-commit.ci - pr: success, Pre-commit Checks, Data Validation, CodeQL and labeler success, Python Tests in_progress.

6. Bounds

  • Route: cloned the repo, fetched refs/pull/524/head, and diffed against origin/main. PR metadata came from the REST API.
  • The trigger's head was 940e967. The PR head is now b2e9032, a pre-commit.ci auto-fix that only removes one blank line. I reviewed b2e9032.
  • Read in full: the diff, REVIEW.md, the edge_case_conference fixture, and sort_by_cfp / sort_by_date_passed in utils/sort_yaml.py. Skimmed: CONTRIBUTING.md and AGENTS.md (they cover data, and none of it applies to a test-only change).
  • freezegun is already a declared test dependency (pixi.toml:50).
  • Not run: the REVIEW.md data check (sort_yaml.py), because no _data files changed; npm test, because no JS changed; pixi itself, which isn't in the sandbox.
  • Pre-existing: none noticed.

Generated by Claude Code

@JesperDramsch
JesperDramsch merged commit 164edf2 into main Nov 2, 2026
11 checks passed
@JesperDramsch
JesperDramsch deleted the ai-agent/friendly-heisenberg-fieds9 branch November 2, 2026 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants